<template>
	<div class="wrapper">
		<div class="pay-wrapper">
			<div class="pay-money">
				￥{{Number(order.order_money).toFixed(2) || 0}}
			</div>
			<div class="pay-btns">
				<div @click="checkOrder">查看订单</div>
				<div @click="navigateTo('/pages/tabbar/home/home', 'switch')">回到首页</div>
			</div>
		</div>
		<div class="pay-box">
			<div class="pay-tag-box text-center">
				<h2>订单支付成功!</h2>
				<!-- <div class="pay-item">
					<div>
						支付方式：
					</div>
					<div>{{paymentMethod === 'wechat'?'微信支付':'支付宝'}}</div>
				</div> -->
			</div>
		</div>
	</div>

</template>
<script>
	import {
		getOrderDetail
	} from "@/api/order.js";
	export default {
		data() {
			return {
				checked: false,
				paymentMethod: "",
				payPrice: 0,
				goodsList: [],
				activeColor: this.$mainColor,
				order: {},
				sn: ''
			};
		},
		onLoad(options) {
			this.sn = options.sn
			this.paymentMethod = options.method
			this.loadData()
		},
		methods: {
			async loadData() {
				uni.showLoading({
					title: "加载中",
				});
				getOrderDetail({
					id: this.sn
				}).then((res) => {
					const order = res.data;
					this.order = order;
				}).finally(() => {
					uni.hideLoading()
				});

			},
			checkOrder() {
				this.navigateTo("/pages/order/order?status=0");
			},

			navigateTo(url, type) {
				if (type === "switch") {
					uni.switchTab({
						url,
					});
				} else {
					uni.redirectTo({
						url,
					});
				}
			},
		},
	};
</script>
<style scoped lang="scss">
	.subscribe {
		justify-content: space-between;
		align-items: center;
		margin: 0 auto 40rpx auto;
		padding: 0 20rpx 20rpx;
		width: 80%;
	}

	.pay-btns {
		display: flex;
		width: 50%;
		justify-content: space-between;
		margin: 0 auto;
		color: #fff;

		>div {
			padding: 6px 12px;
			border: 1px solid #fff;
			border-radius: 100px;
		}
	}

	.pay-money {
		line-height: 1;
		font-size: 50rpx;
		color: #fff;
		margin-bottom: 50rpx;
	}

	.pay-item {
		font-weight: bold;
		margin: 32rpx 0;
		display: flex;
		justify-content: space-between;
		font-size: 24rpx;
		color: rgba($color: $main-color, $alpha: 0.8);
	}

	.pay-box {
		overflow: hidden;
	}

	.pay-tag-box {
		width: 80%;
		margin: 80rpx auto 40rpx auto;
		padding: 20rpx;
		// border-radius: 20rpx;
		// background: rgba($color: $main-color, $alpha: 0.2);

		>h2 {
			margin-top: 20rpx;
			font-size: 40rpx;
			color: $main-color;
		}
	}

	.pay-wrapper {
		background-image: linear-gradient(90deg, #fa123b, #ff6b35, #ff9f28, #ffcc03);
		height: 380rpx;
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.pay-box {
		transform: translateY(-20rpx);
		width: 100%;
		background: #fff;
		// border-top-left-radius: 30rpx;
		// border-top-right-radius: 30rpx;
	}
</style>